package com.hzit.hzb.core.controller.api;

import com.hzit.common.result.R;
import com.hzit.hzb.core.pojo.entity.Dict;
import com.hzit.hzb.core.service.DictService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@RestController
@RequestMapping("/api/core/dict")
@Api(tags = "字典接口")
@Slf4j
public class DictController {

	@Autowired
	private DictService dictService;
	/**
	 * 根据字典code查询其下的子节点列表
	 * @param dictCode
	 * @return
	 */
	@GetMapping("/findByDictCode/{dictCode}")
	public R findByDictCode(@PathVariable("dictCode") String dictCode){
		List<Dict> dictList = dictService.findByDictCode(dictCode);
		return R.ok().data("dictList",dictList);
	}
}
